<?php
namespace app\admin\controller;
use app\admin\common\Base;
class Settings extends Base
{
	public function index(){
		//+--------------------------------------
		//+				系统参数
		//+--------------------------------------
			$data=db('system_company')->where('enterprise_id',$this->EnterpriseId)->select();
			if (request()->isPost()) {
			$data=input('post.');
			//获取post过来数据
				$date=[
					'company_name'=>$data['companyName'],
					'company_address'=>$data['companyAddress'],
					'company_tele'=>$data['companyTel'],
					'company_fax'=>$data['companyFax'],
					'company_code'=>$data['postcode'],
					'company_time'=>time(),
					'company_base'=>$data['currency'],
					'company_quantity'=>$data['qtyPlaces'],
					'company_up'=>$data['pricePlaces'],
					'company_stock'=>$data['valMethods'],//1是先进先出算法2是平移平均算法
					'company_inspect'=>$data['requiredCheckStore'],
					'is_del'=>0,
					  ];
			//公司名称验证
			foreach($data as $k =>$v ){
				if ($v=='') {
					return json(['code'=>1,'msg'=>'表单不能有空']);
				}
			}
			//更新数据	
			if (db('system_company')->where('enterprise_id',$this->EnterpriseId)->update($date)) {
				return json(['code'=>2,'msg'=>'保存成功']);
			}
			}else{

			}
			$this->assign('list',$data);
			return $this->fetch('index');
		
	}	
		
}